There exist a game machine which displays an image (hereinafter, referred to as an image viewed from a third person viewpoint) taken by a virtual camera placed behind a character operated by a player (a player character), and a game machine which displays an image (hereinafter, referred to as an image viewed from a first person viewpoint) taken by a virtual camera placed in a position of the player character as a scene viewed by the player character.
A sight point of the virtual camera is, in general, fixedly set in a position of the player character, or a position at a predetermined distance from a front of the player character.
Japanese Patent Laid-Open Publication No. H10-165647, for example, discloses a game machine generating an image viewed from the first person viewpoint by setting a sight point based on a character located nearest the virtual camera. If there are a plurality of characters equidistant from the virtual camera, the above-described game machine sets a sight point in an intermediate position of these characters.
However, if the sight point of the virtual camera is fixedly set to the player character, there arise the following problems: when the player character leads a party of friend characters, for example, a balance of the characters' placement on a screen is disrupted, and a party of the friend characters behind the player character may be poorly displayed.
Also, if the sight point is set to a character located nearest the virtual camera, the character nearest the virtual camera is always displayed at the center of the screen. As a result, even if a formidable enemy character is located right outside the display screen, the player has difficulty in locating out the enemy character, which may be a problem.
Furthermore, when an image viewed from a third person viewpoint is generated, it is not preferable to set a sight point to a character located nearest the virtual camera because there is a possibility that a character nearest the virtual camera may be a non-player character. Specifically, in the case where a character located nearest the virtual camera is a non-player character, there is a possibility that only the non-player character is displayed on the screen and the player character is not displayed thereon.
Also, if a sight point is set in an intermediate position of the plurality of characters, there also arises the same problem as described above. For example, when an image showing the player character leading a party of friend characters viewed from a third person viewpoint is generated, there is a possibility that a sight point is set around a center of a party of the friend characters and the player character is not displayed.
The illustrative embodiments provide an image generating program and a game device capable of generating a display image in which characters are displayed in a balanced manner.
If there is a player character, the illustrative embodiments provide an image generating program and a game device capable of generating a display image in which characters are displayed in a balanced manner while displaying the player character preferentially over other characters.
The illustrative embodiments have the following aspects (notes in parentheses indicate exemplary elements which can be found in the illustrative embodiments to follow, though such notes are not intended to limit the scope of the example embodiments).
A storage medium of the illustrative embodiments stores an image generating program which causes a computer to generate a display image used for displaying a plurality of objects placed in a two-dimensional or three-dimensional virtual space. The image generating program causes the computer to function as weight storing means (214, FIG. 6), position storing means (214, FIG. 6), barycenter determination means (202, S306), and display image generating means (202, S116). The weight storing means stores weights of the objects. The position storing means stores positions of the objects in the virtual space. The barycenter determination means determines a barycenter of the objects based on the weights and the positions of the objects. The display image generating means generates a display image in which the barycenter lies in approximately a center of the display image. Here, “an object” corresponds to an arbitrary object in a virtual space, and includes not only a movable object such as a player character or a friend character but also a stationary object such as a treasure box or a tree. Also, each character's weight stored by the weight storing means may be unchangeably fixed to a predetermined value, or may be updated, if necessary.
An object to be displayed preferentially has a heavier weight than other objects. In this case, “an object to be displayed preferentially” includes, for example, an enemy character having a formidable weapon, a boss character, a ball in a baseball game, and a specific tropical fish selected by a user from among a plurality of tropical fishes in a virtual aquarium, etc. That is, “an object to be displayed preferentially” varies depending on the use of the image generating program.
Also, the heaviest weight may be assigned to a player character which is operatable by a player with operation means (50).
Also, a level of importance may be previously provided for each object (FIG. 7), and the image generating program may further cause the computer to function as weight associating means (214, FIG. 8) for assigning a heavier weight to the object for which a higher level of importance is provided compared to other objects.
Also, a weight equal to or greater than the sum of weights of objects other than the player character may be dynamically assigned to the player character (FIGS. 19 and 20).
Also, as the barycenter determination means, the image generating program may cause the computer to determine a barycenter of objects placed within a predetermined area, which is a portion of the virtual space (FIG. 23). A shape of the predetermined area may be arbitrary. For example, the predetermined area may be a closed area whose outer edge is at a predetermined distance from the player character, or may be a rectangular area whose center is at a predetermined distance from a front of the player character.
Also, if a barycenter determined by the barycenter determination means lies in a position away from a position of specific one object of the plurality of objects at equal to or greater than the predetermined distance, the image generating program may cause the computer, as the display image generating means, to generate a display image in which an intersection point of a line segment connecting the barycenter and the specific one object and an outer edge of the allowable limit lies in approximately a center of the display image (FIG. 24).
The above descriptions can be applied to either a two-dimensional virtual space or a three-dimensional virtual space.
If the virtual space is a three-dimensional virtual space, the image generating program may cause the computer, as the display image generating means, to generate a display image using a virtual camera whose sight point is the barycenter. In this case, a weight of specific one object of the plurality of objects may change in accordance with a position of the virtual camera. For example, the closer a distance between the virtual camera and the sight point becomes, the heavier a weight of the specific one object becomes (FIGS. 25 and 26).
Also, if the virtual space is a three-dimensional space, the image generating program may cause the computer, as the display image generating means, to generate a display image by bringing the sight point of a virtual camera closer to the barycenter determined by the barycenter determination means at a constant rate.
A game device of an illustrative embodiment generates a display image used for displaying a plurality of objects placed in a two-dimensional or three-dimensional virtual space. The game device comprises weight storing means (214, FIG. 6), position storing means (214, S306), barycenter determination means (202, S306), and display image generating means (202, S116). The weight storing means stores weights of the objects. The position storing means stores positions of the objects in the virtual space. The barycenter determination means determines a barycenter of the objects based on the weights and the positions of the objects. The display image generating means generates a display image in which the barycenter lies in approximately a center of the display image.
Based on one illustrative embodiment, the barycenter determined based on the weights of the objects lies in approximately a center of a display image, whereby it is possible to display the objects on a display screen in a balanced manner. Also, the barycenter lies near the objects whose weight is heavier than other objects, which makes it easy to generate a display image in which an object with a heavier weight than other objects lies closer to the center of the display screen. Thus, it is possible to obtain a display image capable of displaying objects in a balanced manner while displaying the player character preferentially over other characters, by setting a weight of each character arbitrarily.
Especially, in the case where the heaviest weight is assigned to the player character, the player character is displayed preferentially over other characters, whereby it is possible to prevent the player character from moving outside a display area.
Also, based on a level of importance previously assigned to each character, if an object with a higher level of importance has a heavier weight than other characters, it is possible to display an object with a higher level of importance on a preferential basis.
Also, if a weight equal to or greater than the sum of the weights of other characters is dynamically assigned to the player character, a weight of the player character is increased in accordance with an increase in the number or the weight of other characters, whereby it is possible to facilitate the player character being always displayed.
Also, if the barycenter is determined based on the objects within a predetermined area, it is possible to prevent the barycenter from being set in an unexpected position, and reduce an amount of calculation required for determining the barycenter.
Also, in the case where the barycenter lies outside a predetermined allowable limit which is centered around specific one object, a display image is generated such that an intersection point of a line segment connecting the barycenter and the specific one object and an outer edge of the allowable limit is approximately a center of the display image. In this case, the specific one object can be displayed even if the barycenter moves away from the specific one object.
Also, if the barycenter is set as a sight point of the virtual camera, a display image which is centered around a barycenter in the three-dimensional space can be generated easily.
Also, if a weight of specific one object changes in accordance with a position of the virtual camera, it is possible to perform control, for example, such that the closer the distance between the sight point and the virtual camera becomes, the heavier the weight of the specific one object becomes. In this case, the specific one object can be always displayed even if the virtual camera becomes closer to the sight point.
Also, in the case where a sight point of the virtual camera is brought closer to the barycenter determined by the barycenter determination means at a constant rate, it is possible to prevent a sudden change in a display content even if the position of the barycenter changes abruptly. As a result, it is possible to display an easily viewable image.
These and other aspects of the illustrative embodiments will become more apparent from the following detailed description of the illustrative embodiments when taken in conjunction with the accompanying drawings.